﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<Telerik.Web.Mvc.GridModel>" %>
<%@ Import Namespace="Microhard.Framework.MVCHelper" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    产品类别管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            产品类别管理
        </div>
        <div class="options">
        </div>
    </div>
    <table width="100%">
        <tr>
            <td class="adminTitle">
                &nbsp;
            </td>
            <td class="adminData">
                &nbsp;
            </td>
        </tr>
    </table>
    <p>
    </p>
    <table class="adminContent">
        <tr>
            <td>
                <%Html.Telerik().Grid<Microhard.Protal.Models.CategoryModel>((List<Microhard.Protal.Models.CategoryModel>)this.Model.Data)
                    .Name("us-grid")
                         .ToolBar(t => t.Template(g =>
                    { 
                %>
                <div class="header-menu">
                    <ul class="t-widget t-reset t-header t-menu">
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_AddButton("btnAdd", "添加", "Create", "Category", "Protal")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_UpdateButton("btnUpdate", "修改", "us-grid", "Update", "Category", "Protal")%>
                        </li>
                        <li class="t-item  t-state-default">
                            <%=Html.Authorized_DeleteButton("btnDelete", "删除", "us-grid", "Delete", "Category", "Protal")%>
                        </li>
                    </ul>
                </div>
                <%}))
                         .Columns(columns =>
                    {
                        columns.Bound(x => x.CategoryID)
                       .Template(x => Html.CheckBox("checkedRecords", new { value = x.CategoryID, @class = Html.GridSelectingUsedCSS() }))
                       .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= CategoryID #>' class='" + Html.GridSelectingUsedCSS() + "'/>")
                     .HtmlAttributes(new { style = "text-align:center" }).Title("选择");

                        columns.Bound(x => x.Name).Title("名称");
                        columns.Bound(x => x.ParentCategoryName).Title("父类型");                      
                        columns.Bound(x => x.CreationTime).Title("创建时间");

                    })
                      .Pageable(settings => settings.Total(Model.Total).PageSize(Html.GetGridPageSize()).Position(GridPagerPosition.Top))
                      //绑定搜索按钮，执行对应的action
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("_List", "Category"))
                    .EnableCustomBinding(true)
                    .Render();
                %>
            </td>
        </tr>
    </table>
</asp:Content>
